home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / net / bind-contrib.tar.gz / bind-contrib.tar / contrib / doc / doc4.awk < prev    next >
Text File  |  1996-10-25  |  1KB  |  57 lines

  1. #
  2. # doc4.awk
  3. #
  4. #      Distributed with:  Doc - Version 2.0 (8/22/90)
  5. #      USC Information Sciences Institute
  6. #
  7. #
  8. # Accepts as input, output from dig querying for NS records of a
  9. # domain.  Expects input to include TTLs and to be all lower case.
  10. # Also expect to get address of these nameservers in the Additional
  11. # section.
  12. #
  13. # Ouput a list of internet dot-notion addresses of nameservers
  14. # for domain. Only does so if domain name of server is in domain.
  15. # i.e. vax.darpa.mil. is a nameserver for isi.edu., but we are
  16. #      not interested in addresses not on isi networks
  17. #
  18. # Currently, if more than one address (of some server) are on the
  19. # same network (subnets not recognized), only one is printed.
  20. # Arguably for completeness, all address should be printed.
  21. #
  22. # Intended use: targets for queries to check for presence of
  23. # in-addr.arpa mappings for domain.
  24. #
  25.  
  26. BEGIN {n=0}
  27.  
  28. ## Find domain being tested (will be NS record for it)
  29.  
  30. $4 == "ns" {
  31.   ns = $1;
  32. }
  33.  
  34. ##
  35. ## Look at A records, presumably Additional answers
  36. ## for addresses of nameservers.
  37. ##
  38.  
  39. $4 == "a" && ns != "" {
  40.     if (index($1,ns) > 0) {      ## is server name in domain ?
  41.        split($5, dd, ".");
  42.        if (dd[1] < 127) {
  43.           ii = dd[1];
  44.        } else if (dd[1] < 192) {
  45.           ii = dd[1] dd[2];
  46.        } else {
  47.           ii = dd[1] dd[2] dd[3];
  48.        }
  49. #       print "DDT", ii, hnet[ii], $5
  50.        if (hnet[ii] == "") {
  51.           hnet[ii] = $5;
  52. #          print "DDT:" , $0
  53.           print $5;
  54.         }
  55.       }
  56. }
  57.